Declaring template function friends involves some incredibly unintuitive syntax, even for C++! What is the rationale behind the choice of syntax for the extra <>
Wait. You are not declare a friend template. You declare a specialization of a template as friend! As such, why would you want to put a template
clause there?
The syntax to name specializations of function templates is by teplateName
, and that is what you shall use according to the Standard in the friend declarations.
If you want to befriend the whole template and all specializations generated and explicitly specialized, you can still do that, and then you can use a template clause
template
friend void bar(Foo);