https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86392
Bug ID: 86392 Summary: templatized friend member function needs declaration Product: gcc Version: 8.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rene.r...@fu-berlin.de Target Milestone: --- Hi, I need some help to understand the following behaviour. I have a class with a friend get<pos|type> function which implements the behaviour of std::get. However, the compiler can't find the get function in my namespace unless I either declare some global function template with the name get. But it does not even have to match the friend's declaration, as long as the name is declared once in the namespace or I made with using std::get some get visible in the context. Now, I was wondering why for such a template function ADL doesn't work. Note that it works without out-of-class declaration if the friend template function uses all it's template parameters as arguments. So for example: template <typename t> class foo { template <typename _t> friend auto bar(_t && a, foo && b) { ... } }; would work and the compiler will find bar(3, foo{}); The same behaviour happens with clang, so I think I am just missing something here and I would appreciate a short explanation. Sorry for bothering you with probably such simple concerns.