Hilary Duff has hinted she lost her virginity to Joel Madden.

The 27-year-old actress dated the Good Charlotte rocker, 35, from the age of 16 until she was 19 and, although she's remained tight-lipped on their three-year relationship, she has implied he was the first person she had sex with.

Speaking in the April issue of Cosmopolitan magazine, she said of the musician: ''I had a 26-year-old boyfriend. So everyone can make their own assumptions about what I was doing.''

Joel went on to marry Nicole Richie, with whom he has Harlow, seven, and Sparrow, five, while Hilary tied the knot with MIKE COMRIE and has two-year-old son Luca with him.

Despite marrying the retired ice hockey player in 2010, the former child star has admitted it hasn't always been about relationships as she once had a secret friend, who came with naughty benefits.

Asked if she's had a relationship that was purely sexual, she said: ''I've enjoyed myself. I think everyone should have something where you know it's not exactly what you're looking for but you just have a wicked good time. That was freeing for me and a bit of an awakening. It's fun to have a secret.''

Meanwhile, the blonde beauty, who split from Mike last year, believes she's had a successful career without going off the rails because she had a ''massive friend cleanse'' as a teenager.

She said: ''At 19, I did a massive friend cleanse. That was really hard, to sit down with people and say 'We can't be friends anymore.' They were like 'That's f***ed up; you're a b***h.' But having a good reputation was important to me. That's not to say I didn't screw up and do little naughties here and there.''