A friend function can access all private protected and public data of a class.
A class has to declare a function or another class as a friend. Also the friendship is one way. Class A is friend of class B does not mean that class B is friend of class A. So the control is in the hands of a class.
That way it is not against the data hiding principle of OOPs. It may be used to make exceptions to the normal rules of private and protected data. It should be used wisely and it should not be a practice to use friends heavily.
Some OOPs languages like C# do not support a concept of friends.