Your guy friend admits he likes you but he has a girlfriend?

So i have this friend named Daniel and he's cool and lately we've been hanging out with a group of friends including his gf. And I'm having problems with my bf and he'll ask me if anything is okay and stuff and I'll tell him but recently after I told him how me and my bf are about to break up he suddenly confesses that he likes me and I'm over here like " but you have a gf..." And I reminded him that he should respect his gf by not telling me that and we can still talk but don't flirt with me. Which he still tries to of course. And I'm trying to avoid problems from happening and now i just text him less because j don't want his gf thinking I'm into him or anything like that. Why is this even happening and why did he tell me he likes me? But I do remind him about his gf and he talks about her a lot which is a good thing but still I feel awkward.
Your guy friend admits he likes you but he has a girlfriend?
Post Opinion