#include <string>
#include <list>
#include <iostream>
struct A {
    std::string name;
    A(const std::string& name) : name(name) {}
};

struct pA_comp {
    bool operator() (const A* left, const A* right) const { 
       return left->name < right->name;
    }
};
int main()
{
    std::list<A*> list = {new A("c"), new A("a"), new A("b")};
    list.sort(pA_comp());

    for(auto i = list.begin(); i!=list.end(); ++i)
    {
        std::cout << (*i)->name << '\n';
        delete *i;
    }
}
