Let us define f
, as a friend function of S
, inside the declaration of S
:
struct S
{
friend void f() {}
};
I cannot find a way to call f
.
Is it true, then, that such an inline friend function can only be called with argument-dependant lookup?
struct S
{
friend void f() {}
friend void g(S const&) {}
} const s;
int main()
{
// f(); // error: 'f' was not declared in this scope
// S::f(); // error: 'f' is not a member of 'S'
g(s);
// S::g(s); // error: 'g' is not a member of 'S'
}
Bonus: what if I want to get a function-pointer/std::function
/lambda to g
?