Question:The following code demonstrates the problem.
It probably has to do something with argument dependent lookup, but i cannot really get it.
Answer:The problem is that the friend declaration for
foothat you’ve provided is for a non-template function but while calling bar you’re trying to use
fooas a template.
There are 2 ways to solve this:
Here we provide a separate parameter clause for
Here we provide a forward declarations for the function template
fooand then define it later outside the class.
If you have better answer, please add a comment about this, thank you!