How does class inheritance work? But first, why do we care about inheritance at all? There are primarily two reasons. The first is convenience. The second is that classes make it possible to create from a single set of definitions. In principle, private and protected members of a class cannot be accessed from outside the same class in which they are declared. However, this rule does not affect friends. Just as we have the possibility to define a friend, we can also define a friend as a member of a class. A general class can be inherited by the other classes. A class that is inherited is called a base class. A class which is inheriting another class is called a derived class. When a class inherits another class, members of the base class become the members of the derived class.