WASHINGTON  They have been foes and they have been, kind of, friends. And on Friday afternoon, President Obama and former President Bill Clinton walked unexpectedly into the White House briefing room for a news conference that was part surreal flashback, part one-two political punch.

With Mr. Obama standing largely silently at his side, Mr. Clinton took over the lectern to lend his backing to the tax compromise the White House reached this week with Republicans. And then Mr. Clinton went on, for half an hour, answering questions and holding forth on topics from triangulation to Haiti to the mortgage crisis and the nuclear arms treaty with Russia.

Even after the 44th president excused himself and left the room, the 42nd went on. On cable TV, Mr. Clinton’s presence in front of the blue backdrop with the White House logo was familiar, as were the wagging finger and the occasional bitten lip.

Mr. Clinton and Mr. Obama turned up suddenly after meeting privately together for almost 90 minutes in the Oval Office. With no warning to Mr. Obama’s aides, the two men wandered through the nearly deserted West Wing  most staff members were at a holiday party  and tried to get into the briefing room but found the door locked. Only after they finally encountered Robert Gibbs, the White House press secretary, were arrangements made to turn on the lights and microphone and assemble the press corps.