Question: i have 

```
 class c1{

public:
    int number;

    c1()
    {
        number=rand()%10;
    }

    bool operator < (c1 *w)
    {
        return number < w->number;
    }

};

vector<c1*> vec = { ... }
sort(vec.begin(),vec.end()) 

```

why it dosent sort ?

but if we had 

```
 bool operator < (c1 w)
    {
        return number < w.number;
    }

```

and

```
vector<c1> vec = { ... }

```

it would have been sorted !

Answer: 
The most straightforward approach is to define a function

```
bool c1_ptr_less( c1 const *lhs, c1 const *rhs ) {
    return lhs->something < rhs->something;
}

std::sort( vec.begin(), vec.end(), & c1_ptr_less );

```

What I would suggest is a generic functor to take care of *all* pointer arrays

```
struct pointer_less {
    template< typename T >
    bool operator()( T const *lhs, T const *rhs ) const
        { return * lhs < * rhs; }
};

std::sort( vec.begin(), vec.end(), pointer_less() );

```

Armed with this, define the usual `c1::operator< ( const c1 & )` and likewise for other classes.

Generally, best practice is to avoid pointers entirely, including arrays of pointers.
phimuemue's answer sums it up, I'll just add that, as a workaround, you can create a wrapper class that contains only one member - a pointer to c1, and then overload its operator <. Then you could sort a vector of object of that class.