A C++ friend functions are special functions which can access the private members of a class.Logical use of them can make them useful in certain cases. For instance: when it is not possible to implement some function, without making private members accessible in them. This situation arises mostly in case of operator overloading.
A class can also be declared to be the friend of some other class. When we create a friend class then all the member functions of the friend class also become the friend of the other class. This requires the condition that the friend becoming class must be first declared or defined (forward declaration).
Another property of friendships is that they are not transitive: The friend of a friend is not considered to be a friend unless explicitly specified.