How to cast a parent actor to a sub actor

Have GetSoldierClass() be a function inside of an interface (eg. ISoldier).

Have all soldiers implement the interface ISoldier.
Then you can have GetSoldierClass() return a specific class in each variant
Each solder type presents it own class through the same command

The interface is like a contract that guarantees that the classes have an implementation of it’s functions.

No casting is then required.