The problem with your example is that friend functions are not defined when they are declared as a friend. They are defined elsewhere. Try removing the body of the friend function to outside the class and see if the suggestion changes.
As you have it, the function is declared as a friend, but is actually a member! I would be surprised if it compiled successfully.
The problem with your example is that friend functions are not defined when they are declared as a friend. They are defined elsewhere. Try removing the body of the friend function to outside the class and see if the suggestion changes.
As you have it, the function is declared as a friend, but is actually a member! I would be surprised if it compiled successfully.
quote:(from MSDN)
C++ Language Reference
Defining Friend Functions in Class Declarations
Friend functions can be defined inside class declarations. These functions are inline functions, and like member inline functions they behave as though they were defined immediately after all class members have been seen but before the class scope is closed (the end of the class declaration).
Friend functions defined inside class declarations are not considered in the scope of the enclosing class; they are in file scope.
Personally I didn't know it was possible, but MSDN doesn't mark it as 'Microsoft extension'. In any case, since it's correct for VC++, VA X indeed shouldn't treat that function as a member of the class.