I think (I can't seem to find a good reference online) that functions that are friends cannot be member functions of another class. Therefore, if the compiler sees a friend function enclosed in a class definition, it can assume that the function is indeed free, so there is no error.

Classes can be friends of other classes, which would allow the member functions of one class access to data members of the other.

Viggy