In some circumstances, it is more convenient to grant member-level access to functions that are not members of a class or to all functions in a separate class. Thefriend keyword allows programmers to designate either the specific functions or the classes whose functions can access not only public members, but also protected and private members.