This documentation is archived and is not being maintained.

Compiler Error C2689

'function' : a friend function cannot be defined within a local class

You can declare but not define a friend function in a local class.

The following sample generates C2689:

// C2689.cpp
void f2();
void g()
   class X
      friend void f()
      {   // C2689
      // ok
      // friend void f2();