with the following code (a boiled-down version of my original code)
#include
#include
template class A;
As I have figured out by now (see also the edits to the question) what the problem was. It turns out that all answers (sofar) didn't solve the (full) problem.
Essentially, the evaluation of the decltype
expression for the global function required eventually the private member A
(through its occurrence in the decltype
expression of A
). This opens the next question about what the standard says about this.