Friend Class

A friend class in C++, can access the "private" and "protected" members of the class in which it is declared as a friend. On declaration of friend class all member function of the friend class become friend of the class in which the friend class was declared. Friend status is not inherited; every friendship has to be explicitly declared. Friend classes can help in improving Encapsulation if used wisely.

Read more about Friend Class:  Declaration, Advantages of Using Friend Class, Two Classes Accessing Private Data To Each Other, Scope, Features, Friend and Encapsulation

Famous quotes containing the words friend and/or class:

    Not a flower, not a flower sweet
    On my black coffin let there be strewn.
    Not a friend, not a friend greet
    My poor corpse, where my bones shall be thrown.
    A thousand thousand sighs to save,
    Lay me, O, where
    Sad true lover never find my grave,
    To weep there.
    William Shakespeare (1564–1616)

    We must not discriminate between things. Where things are concerned there are no class distinctions. We must pick out what is good for us where we can find it.
    Pablo Picasso (1881–1973)