The minimum amount of code that reproduces the problem. I have a pointer of static type A, which points to a valid B.

I'd like to handle said pointer like a B, but not create a new pointer => I though of using a reference.

Code:
class A{};
class B : public A{};

int main()
{
  A* pA = new B;
  B*& pB1 = static_cast<B*>(pA); //error: invalid initialization of non-const reference of type 'B*&' from a temporary of type 'B*'
  B*& pB2 = static_cast<B*&>(pA); //error: invalid static_cast from type 'A*' to type 'B*&'
}
I can understand why both of these examples don't compile, but how could I get it to work? I pretty sure what I'm trying to do is legal...

I'd use reinterpret_cast, but it wouldn't work if B actually had multiple inheritance...

Any help?