You need to use a vector of pointers. Fortunately, since you are using VS2012, you have modern smart pointers (with some other C++11 goodness):
typedef std::vector<std::unique_ptr<a>> DataVector;
DataVector GetData() {
DataVector data;
data.push_back(std::unique_ptr<b>(new b(1)));
data.push_back(std::unique_ptr<c>(new c(1)));
return data;
}
void PrintData() {
for(const auto & datum : GetData())
std::cout << datum->GetX() << std::endl;
}