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: 
To answer your title question, you can't.

Pointers are built-in types, you cannot override operators where all operands are built-in types.

Luckily, there's an overload of `std::sort` that allows you to specify a comparison function (or functor) so the `operator<` isn't used.
And in your example, `vector<c1*>` is sorted. Just not to the
criteria you seem to want: by default, `sort` uses
`std::less<T>` as the ordering criteria, and `std::less<ci*>`
compares the pointers (which is what you'd expect). If you
don't want the default criteria, then you have to pass a third
argument to `sort`, a predicate defining the ordering you want.

And of course, your member `operator<(c1*)` will only be called
when you compare a `c1` with a `ci*` (and only if the `c1` is an
rvalue). Such operators are very, very rare---normally, both
sides of a `<` operator should take the same type (and should be
`const`, since a `<` operator which modifies the values of the
objects it compares would be surprising, to say the least).