Absolutely. For a number of reasons.
First, we are not totally instinctually-driven beings with no control over our instincts or actions. So in light of these feelings one might experience at certain points towards a person, one does not have to succumb to them. We have control over our actions.
Secondly, it seems rather narrow minded and slightly offensive to assume one cannot be friends with a person they are attracted to. If this is the case, this is to assume that the attraction is the overriding force in the relationship and that nothing else of worth or redeeming quality exists within that person who is your friend, to whom you also feel attracted. That would be a very sad thing. And would probably not indicate that this is a real friendship of any depth or caring.
Relationships (whether it’s a friendship, a romantic one or a family member) are multi-faceted, multi-layered things. Like an intricately woven blanket with lots of overlapping stitching and layers. Just because you feel moments of attraction to someone does not mean that 1. you cannot stretch yourself a bit, endure these feelings and deal with them until they pass (because they will pass. All emotional states are only temporary, changing and evolving all the time) and that 2. you cannot feel other things for this person too (along with moments of temporary attraction), such as respect….deep caring…joy…fun in their company…inspiration…liking, etc. Other things that make the friendship a worthwhile thing to treasure and keep in one’s life.
We are not one sided beings so that if an attraction exists, this should not necessarily mean that the friendship must end immediately. Not the case at all. (Side-note: I do think in certain situations, if the attraction is the primary and dominating emotion in the relationship, then yes, it is likely a good idea to end the friendship if a romantic relationship is not something that both parties in the friendship want). But assuming it’s an occasional thing, a once-in-a-while feeling, this is absolutely not a reason to end a friendship. It would not be worth throwing away something that is otherwise a quality relationship that adds to one’s life just because of occasional flickers of a feeling (a feeling that, as mentioned above, will pass).
A truly good friendship is a wonderful and rare thing, whether it’s found with someone of the same gender or the opposite.