Compiler Error C2391
'identifier' : 'friend' cannot be used during type definition
The friend
declaration includes a complete class declaration. A friend
declaration can specify a member function or an elaborated type specifier, but not a complete class declaration.
The following sample generates C2326:
// C2391.cpp
// compile with: /c
class D {
void func( int );
};
class A {
friend class B { int i; }; // C2391
// OK
friend class C;
friend void D::func(int);
};
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for