“Merrily We Roll Along” was a moderate hit as a stage play by George S. Kaufman and Moss Hart in 1934, but when Stephen Sondheim turned it into a musical in 1981, it became one of his few flops, closing in mere weeks. But now it’s been revived with stars Jonathan Groff, Daniel Radcliffe, and Lindsay Mendez, and whatever was wrong with it 42 years ago has somehow been fixed.

Franklin Shepard (Groff) and Charley Kringas (Radcliffe) are longtime friends and songwriting partners who, after several successful Broadway shows, have gotten to the point that so many creative duos reach. Franklin has more ruthless ambition, having moved into movie producing, and always wants something new. That explains why he’s been through several marriages and relationships, mostly with stars of his shows. Charley, on the other hand, is the quiet, rational one, happy to be a lyricist with a wife and several kids, and no desire to play show business games.

Radcliffe is top-billed because his name helps fill the seats. The night we were there, the audience contained several groups of women in their twenties and thirties who had grown up loving him as Harry Potter and were now so excited to see him in person they were never less than thrilled by every single thing he did. His spotlight moment comes during a scene where the guys appear on the “Today” show, ostensibly to promote their latest project, but Charley can’t help turning it into an extended rant about Franklin.

However, it’s Groff who crushes it in the meatier role, portraying the success-obsessed Franklin with swagger, bluster, and one hell of a voice. Since leaving “Hamilton” in 2015, he’s spent his time in movie and TV roles, but this highly charismatic performance will likely give him the opportunity for a lot more leading roles on Broadway.

Mary (Mendez) is the third leg of the triangle, but not romantically (despite her obvious attraction to Franklin). She’s written a bestselling novel, but after struggling to develop another, she became a theater critic, a job much better suited to her ability to observe the world and offer snarky comments. She serves as kind of a one woman Greek chorus, aided by prodigious amounts of alcohol. It’s a thankless role, but Mendez makes the most of it as Mary looks askance at the changes in Franklin over the years and the sycophants who surround him.

“Merrily We Roll Along” tells its story in reverse chronological order, from the mid-1970s back to the mid-1950s, which means lots of period costumes and references. And songs. Lots and lots of songs. The kind of Broadway tunes that start in the middle of some dialogue and build to a roaring climax, with plenty of dancing mixed in, too.

Together with a strong supporting cast, Groff, Radcliffe, and Mendez — with inspired direction by Maria Friedman — have turned Sondheim’s onetime flop into a rowdy yet fun theatrical experience. With a large cast and a full orchestra, the show will likely be pared down for its inevitable national tour, but meanwhile, this Broadway version is going to sell a lot of tickets. And probably win some Tonys, too.