class a { private b; a::a(){ b=new b(&this); } } public class b{ private a *a; b::b(a *p){ a=p; } }