C++ Access private member of nested class -
the title might bit misleading. have following problem: have tree consisting of leaves , internal nodes. user should able store information in leaves and tree has methods set of user-defined values , need access corresponding leaves in constant time (not amortized). i came following idea not work because unfortunately cannot access private members of nested class: user creates tree and each leaf instance of userelement contains user_defined value corresponding leaf. once method dosomethingwiththetree(list>) called , tree built, tree creates corresponding leaves , saves in private field leaf . whenever user wants call method of leaves corresponding user_defined values, he/she has call method giving corresponding userelement s , tree can retrieve corresponding leaves in constant time. class tree { public: template <typename t> class userelement { private: t user_value; tree_node* leaf; // has private ...