cast base class reference instead of base class