Student or Learner
Can we use the expression "It serves you right" in a pleasant situation? For example can we response the following sentence in this way?
A. I'm flattered. Thank you
B. It serves you right
What kinds of responses do you suggest for this conversation?