class A {
    //does stuff
public:
    virtual std::ostream& operator<< (std::ostream& os) = 0;
};
class B : public A {
public:
    //does similiar stuff
    virtual std::ostream& operator<< (std::ostream& os) {
        os << "x" << std::endl;
    }
}
class C {
public:
    A* array[10];
    A* & operator()(int a) {
        // in my code, it is a 2D array indexed with (),
        // but that's irrelevant here
        return array[a];
    }
}
int main(){
    C c = C();
    //in for loop we say c(i) = new B();
    for(int i=0; i<10; i++){
        std::cout << *(c(i)); // error
    }
    return 0;
}
I'm guessing the problem is that my () operator returns with base pointer instead of a pointer of B and A doesnt have <<. But using templates for the indexing doesn't solve the problem either, it just makes it weirder.
Any ideas?
 
     
    