For these kind of things a 'friend' declaration coupled with private would also work, if we could combine it with objects of type A being allowed to access private methods in other objects of type A it would be a plus. :-)
class A { friend A create_a(); // types here not really needed in pike, though. protected int x; protected void init (int i) {x = i;} int get() {return x;} }
class B { friend A create_a(); // types here not really needed in pike, though. protected int x; protected void init (string s) {x = (int) s;} int get() {return x;} }
A create_a() { B b = B(); b->init ("17"); return b; // And all is well, since the types match. }