In memento pattern you mention
"The classic implementation of the pattern relies on support for nested classes, available in many popular programming languages (such as C++, C#, and Java)."
but your example with nested class only applies to java,
c# and c++ nested classes act differently, they do not support private access to other class
Customer support service by UserEcho