You cannot access private members of the
student
class (
default visibility for class members is
private
). It is a general
C++
rule (has nothing to do with nested classes).
You have either to
- Provide accessors for
student
class members (that is get/set methods in student
class itself). - Change to
public
the visibility of student class members. - Declare
friend
the classes that need to access student
class members.