You misunderstood the meaning of secure access.
Protected members are called by derived classes. But only on the base object contained within the class itself.
For example, if I simplified the problem using:
class A { protected: void getValue(){} }; class B : protected A { public: void print(A& input) { input.getValue();
getValue cannot be called on object "A" other than object "A" inside the class itself. This, for example, is valid.
void print() { getValue();
As Dan Nissenbaum and Shakurov noted. This is also true:
void print(B& input) { input.getValue(); }
This is because we explicitly say that the input is object B. And the compiler knows that all objects B protect access to getValue. In the case where we pass A &, the object may be somewhat similar to type C, which can be moved from A with private access.
David source share