# include class Superinteger ; class Integer { public : Integer ( int i ) : i__ ( i ) {} operator Superinteger () const ; // converts Integer to Superinteger friend class Superinteger ; private : int i__ ; } ; class Superinteger { public : Superinteger ( int i ) : i__ ( i ) {} # ifdef ALLOWCONS Superinteger ( Integer in ) : i__ ( in . i__ ) // converts Integer to Superinteger { std :: cout << "Superinteger's constructor was called.\n" ; } # endif private : int i__ ; } ; Integer :: operator Superinteger () const { std :: cout << "Integer's operator was called.\n" ; return Superinteger ( i__ ) ; } void autoConvert ( Superinteger si ) { std :: cout << "autoConvert ( Superinteger ) was successfully called with an Integer argument.\n" ; } int main ( void ) { autoConvert ( Integer ( 20 ) ) ; }