That sometimes happens to me too. Some men say things like that because they think they are entitled to a woman's attention and they want their ego massaged.
Sometimes they'll also tell you you're 'quiet', often in an accusatory way. I had to get a taxi a couple of weeks ago, and as soon as I got in, the driver said 'You're quiet', to which I replied, 'You're observant'! I don't think he understood what it meant because he asked me again
. I just told him my destination. I'm always polite but don't feel like chatting and that's my prerogative.
Even these days Women, especially if they are young and attractive, are still expected to be approachable, available and submissive. It's almost ingrained into them. Men try to make women feel defective and prudish if they don't behave in a way that is acceptable to them, and will often become agressive if they don't get what they want. Even though many women are capable of holding their own and fighting back, it's still intimidating.
I agree with Buc - it will happen less as you get older because as they age, women naturally become less visible to men, and therefore less attractive.