friend in C++

In some circumstances, it's useful for a class to grant member-level access to functions that aren't members of the class, or to all members in a separate class. These free functions and classes are known as friends, marked by the friend keyword. Only the class implementer can declare who its friends are. A function or class can't declare itself as a friend of any class.
Here are a few reasons why friend is a bad idea:
* friend is not required. It is convenient, but not required.
* friend supports bad design. If one class requires friend access to another, you're doing it wrong. (see above, convenient, not required).
* friend breaks encapsulation. Basically, all my privates are belong to me, and that guy over there (my friend).

Some important points about friend functions and classes: 
* Friends should be used only for limited purpose. Too many functions or external classes are declared as friends of a class, it lessens the value of encapsulation of separate classes in OOP.
* Friendship is not mutual. If class A is a friend of B, then B doesn’t become a friend of A automatically.
* Friendship is not inherited.
* The concept of friends is not there in Java or any other programming languages.