You have no control over whether or not other people find you attractive or they flirt with you. However you do have control over whether (you) flirt back.
Most relationships initially start off with some measure of flirting on sexual innuendo. Flirting offers a person a way to "test the waters" to see if there is a (mutual) attraction. At best it can be a (secret fun illicit game) attached/married people play and at worst it can be the gateway to entering into an illicit affair.
Cheating is in the eye of the beholder. If someone presented you a video of your spouse flirting with someone, holding hands walking along the beach, and meeting for lunch multiple times a week....etc Would (you) be okay with it? Would you call it cheating?
The first thing a person does is "justify things" in their own mind.
"Just because I'm married does not mean I can't have friends."
"For all I know she or he might have some (secret friend) that I know nothing about."
"It's not like we're having sex or even kissing for that matter!"
"We're just friends!"
Overtime however it's not uncommon for "secret friends" to open up emotionally towards one another. Reveal their hurt and disappointments about their mates. They become "emotionally invested" in one another while slowly withdrawing emotionally from their spouses. Initially they may begin by offering one another advice on how to improve or deal with their relationships until they come to "realize" that (they) were meant for one another!
Eventually they feel as though life has played a "cruel joke" on them by having them meet after they've married others. The (secrecy) intensifies their sexual urges towards one another and they go for it.
Odds are if it is ongoing they will be found out and the first thing they will say to their spouses is; "We never meant for this to happen." or "The heart wants what it wants."
The reality is they both said "yes" to everything from flirting, to meeting secretly behind their spouses back, to opening up emotionally about their marriages, to kissing, and eventually having sex. It did not just "happen". Saying "yes" makes things happen!
Not all flirting leads to cheating however it is a slippery slope because most new relationships do begin with flirting! If you're unhappy with the mate (you chose) for yourself then end that relationship. No one is stuck with anyone.