prog.cpp: In function 'void f(Child1&)':
prog.cpp:13:20: error: 'Parent' is an inaccessible base of 'Child1'
Parent& parent = child1;
^
prog.cpp:14:10: error: 'Parent' is an inaccessible base of 'Child2'
parent = Child2();
^
prog.cpp: In function 'int main()':
prog.cpp:6:17: error: 'int Parent::number_' is inaccessible
int number_{-1};
^
In file included from prog.cpp:1:0:
prog.cpp:20:17: error: within this context
assert(child1.number_ == 1); // Ok
^
prog.cpp:6:17: error: 'int Parent::number_' is inaccessible
int number_{-1};
^
In file included from prog.cpp:1:0:
prog.cpp:22:17: error: within this context
assert(child1.number_ == 2); // Ok :-) (Surprise for lamers) :-)
^