c++ sort vector of objects by property

C++
class cat {
public:
    int age;
    bool operator< (const cat &other) const {
        return age < other.age;
    }
};vector< cat > catSorter::SortCatsByAge(){
   vector< cat > cats_copy = cats;
   std::sort(cats_copy.begin(), cats_copy.end());
   return cats_copy;
}
Source

Also in C++: