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. With the friend keyword, programmers can designate either the specific functions or the classes whose functions can access not only public members but also protected and private members.