public class A { public int x; public int y } public class B { private int z; private void Test() { A a = new A(); z= a.x+a.y; } }