Speaking as someone who was seriously smitten and heavily involved with a seventeen-year old co-worker when he was twenty-four: Hey, it happens… and as it happens when the flirting goes both ways, there’s plenty of blame when the seventeen year old is doing her level best to put the moves on you, too.
I do have much less of a problem with “professionals in the public trust” like cops, military personnel and firemen hitting on teenagers than “immediate authority figures working closely with teenagers as part of their job,” such as private tutors, schoolteachers and social workers. The latter category has a lot more ethical issues and gray areas than the former due to the nature of their position as opposed to age.
Now, if the cop was working in a high school my objection would return.