Introduction to OOP Chapter 23: Object Interconnections : next previous audio real text

Friends in C++

In C++ a friend (class or method) is allowed access to all parts of a class.
class Complex { 
public: 
	Complex(double, double); 
	friend double abs(Complex&);
private: 
	double rp; 
	double ip; 
};

double abs(Complex& x)
{ 	return sqrt(x.rp * x.rp + x.ip * x.ip); }
Friendship is something that is given away, not something that is taken.
Intro OOP, Chapter 23, Slide 21