Overloaded friend Functions

It’s possible to specify overloaded functions as friends of a class. Each function intended to be a friend must be explicitly declared in the class definition as a friend of the class.

Image Software Engineering Observation 9.12

Even though the prototypes for friend functions appear in the class definition, friends are not member functions.

Image Software Engineering Observation 9.13

Member access notions of private, protected and public are not relevant to friend declarations, so friend declarations can be placed anywhere ...

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.