Undefined reference to friend function template defined inside class in a namespace
This is a follow-up on my answer to this question . The original answer I posted does not have any namespaces, and it solves the problem. However, the OP subsequently made an edit claiming that the solution does not work if the class is inside a namespace. My initial reaction was that you can make it work by simply having using N::f; either at global scope or inside main() (or any other function). While that is certainly the case, the OP (justifiably) commented that this is not ideal, and I agree. Nevertheless, I still thought that calling N::f without having using N::f; should work just fine,