What is the fully qualified name of a friend function defined inside of a class?
What is the fully qualified name of a friend function defined inside of a class? I recently saw an example analogous to the following. What is the fully qualified name of val() below? #include <iostream> namespace foo { class A { int x; public: A(int x = 0) : x(x) { } friend int val(const A &a) { return a.x; } }; } int main() { foo::A a(42); // val() found using ADL: std::cout << val(a) << std::endl; // foo::val(a); // error: 'val' is not a member of 'foo' // foo::A::val(a); // error: 'val' is not a member of 'foo::A' return 0; } Is argument-dependent lookup the only way val() can be found?