In C++, the keyword
friend is used to make member functions (or whole classes) to be able to use private members of another class.
Practically, you can write one function that does strange things to two classes of different types.
C++ also supports
the notion of friends: cooperative classes that are permitted to see each other's private parts.
- Grady Booch, "Object Oriented Design with Applications"
See Bjarne Stroustrup's book The C++ Programming Language, 3rd edition, §11.5 p. 278