So the thing about Cedric and Harry is like,,,
Cedric was about three when baby Harry defeated Voldemort, so though he was too young to really remember that day, he remembers the aftermath. He remembers asking Amos to tell him the story over and over again. He remembers playing pretend with his cousins; someone would be a dark wizard and someome would be the young hero. (Whenever Cedric got to be the hero he would secretly pretend he was the Boy who Lived.) The first few years of his memberable childhood were filled with nonstop, reverent talk of Harry Potter. He thought there could be no one cooler.
As he grew up, and his Hufflepuff empathy started kicking in, he obsessively read books about the Potters and their story and he felt so bad for this boy who didn't have parents anymore, and he just hoped that wherever Harry was he was happy.
Eventually he realized it was likely Harry would come to Hogwarts once he was of school age. So he stopped being an obsessive weirdo (but he still counted down the years until he could meet him.)
The thing was, when Harry finally came to Hogwarts, Cedric couldn't approach him. It was just that everyone was up in his face all the time and Cedric just wanted to yell at them all. Couldn't they see he was uncomfortable? Overwhelmed? So he left him alone, but he can still remember the starstruck feeling he got seeing Harry in person, and he can still remember looking on in awe as Harry was sorted into Gryffindor (of course he was a Gryffindor.)
By his 7th year, Cedric is well-liked and popular, and a talented wizard, but he has pretty much lost all hope of becoming Harry's friend. Over the years, he has watched Harry go back and forth between being revered and despised by the students at school. Cedric doesn't understand them. Everyone just seems to want to use Harry for one thing or another. It breaks his heart, and there were times that Cedric wanted to reach out to ask if he was okay. Harry had his friends though, and Cedric figured he wouldn't want to talk to him about such things.
So other than playing a few quidditch matches against each other, they had barely interacted. But then they travel to the World Cup with Harry and his friends and finally Cedric can be sure that Harry knows that he exists! Cedric tries to be as charming as possible, and tries to cover for his embarassing dad.
That year Cedric enters the Triwizard Tournament. The truth is he pretty much enters the Tournament bc he wants to impress Harry. Other reasons too, but mostly Harry. It's around this time that he realizes he has a gigantic crush on Harry Potter. Then Harry gets chosen too, and it's just the perfect excuse to talk to him. They help each other out with the tasks. Cedric loves talking to him. He flirts, but isnt sure if Harry picks up on it.
But then there's the matter of Cho and their carefully cultivated flirtationship. Cedric is half convinced that he's already in love with Cho. Then one day they're all out on the grounds when one of Cho's ravenclaw friends starts complaining about trying to find a date for the Yule Ball. She said that they are lucky they dont have to figure it out. Then she asks, "who would you be taking, if it werent for each other?"
And at the same time they say, "Probably Harry Potter." And Cedric gets nervous that Cho will be angry, but she just gets that look on her face, the cute one she gets when she has figured something out, and knows something everyone else doesn't.
Then, towards the end of the Ball, they spot Harry sitting alone, no Ron or Hermione in sight. They see Parvati dancing with some other bloke. Cho leads Cedric by the wrist over to where Harry sits. He looks up at them and immediately blushes.
"Not dancing?" Cho asks with a smile.
"No," Harry says, eyes darting back and forth between Cedric and Cho. "Not really my strong point if you didn't notice."
"I thought you did brilliantly, Harry." Cedric says.
"Well don't lie to him Cedric." Cho says. Harry just laughs. "We can teach you, though."
"Dance with us, Harry." She says, and they both take one of his hands and pull him onto the floor. And Cedric doesn't know whats happening but he knows that Cho is a genius and Harry is smiling for the first time all night.