Why I can not cast to TSubclassOf?

Why I can’t do this:

//in class B:
TSubclassOf<A> B::GetClass() {..}

//somewhere else: 
void foo (A* pa, B* pb)
  TSubclassOf<A> type = pb->GetClass();
  auto pab = Cast< type >(pa);   // <<< compiler error here

I get compiler error:

(1845): error C2974: ‘Cast’ : invalid
template argument for ‘T’, type

Is it because of type for Cast<> must be known in compile time?

As the error says Cast template needs a type but your feeding it with a variable name. Also what type do you expect pab to be ?

what type do you expect pab to be ?
I hoped, it will be some subclass of A. Which one exactly must be determined at runtime by what concrete type will pb->GetClass() return