C++ defines a polymorphic class as a class which has at least one virtual function. typeid doesn't do anything special unless its argument is a polymorphic class. So first, add a virtual destructor to car:

class car {
public:
virtual ~car() {}
std::string color;
};

Also, typeid does not act polymorphically on pointers, only on objects / references. Try