Can a man be a woman?

It is possible for a man to become a women through surgery. Also, other than sex, gender is what you think you should be. so if a man thinks he should be a woman, his gender is classified as a woman, when is sex is a man