I have something like the following:
class A { ... };
class B : public A { ... };
// ...
B b;
const A& aref(b);
// ...
const B& bref(aref);
and when I compile, I get:
no suitable user-defined conversion from "const A" to "const B" exists
Now, if these were pointers rather than references, I would use
bptr = dynamic_cast<B*>(aptr);
but references don't have that. What should I do? Switch to pointers? something else?