You need to use the template
disambiguator:
return b.template get<&B::t>();
Without it, when parsing the expression:
b.get<&B::t>();
The compiler can't tell whether it should interpret get
as the name of a member variable followed by a <
sign (less-than), or as the instantiation of a member function template called get
.
Although we know what is the intended meaning of our expression, the compiler cannot, at least not before instantiation occurs - and syntactic parsing is performed even though your function is never instantiated.