Image copyright Reuters Image caption The Trumps, Obamas, Clintons and Carters

They shared a total of 22 years spent living in the White House - and a wooden pew in the National Cathedral for the memorial service of George HW Bush.

It's not often that so many commanders-in-chief, present and past, are gathered in one place.

In recent years it has tended to happen at the funerals of presidents or the opening of presidential libraries.

At the state funeral of the 41st president of the United States in Washington on Wednesday, there were four together in the front row.

When George W Bush arrived and took his place on the other side of the nave, he brought that total to five, and their total years of service running the country to 30.

The significance of the moment was not lost on some.

But the exchange between President Donald Trump and the others seemed tense, which is hardly surprising given their history.

So what exactly happened?

The handshakes and non-handshakes

President Donald Trump and First Lady Melania were the last to arrive. As they took their places at the front pew, they shook hands with the Obamas next to them.

Oh, to know what was going through Michelle Obama's mind as she politely but stiffly greeted Mr Trump.

She recently said in an interview that the birther conspiracy theory pushed by him - falsely claiming Barack Obama was not born in the US - was something she would never forgive him for.

There was no public handshake between Hillary Clinton, who was sitting on the other side of the Obamas, and Donald Trump.

She looked straight ahead and there appeared to be no eye contact between her and her former opponent, in their first meeting since his inauguration.

The 2016 election campaign was marked by acrimony between the two candidates, with the Republican calling for her imprisonment over her use of a private email server.

"Lock her up" became a chant at Trump rallies during the campaign and his presidency.

But First Lady Melania Trump shook Bill Clinton's hand and gave a wave to Mrs Clinton, who nodded her appreciation.

Then along comes another president

George W Bush arrived and shook hands with each of the occupants in the front row.

He seemed to slip something to Michelle Obama - perhaps another sweet, as he did at the memorial service of John McCain.

All thought of bad blood between the Trumps and Bushes was forgotten for this occasion, which amounted to a celebration of a president, father and war hero.

Donald Trump has in the past mocked "low energy" Jeb Bush and derided the presidency of George W Bush.

But this week he has been fulsome in his praise for Bush the elder, and sent one of his iconic presidential jets to deliver the casket from Texas.

George HW Bush himself reportedly wanted the the current occupant of the White House - excluded from the memorial service of Senator John McCain - to be present.

Other occasions where presidents gathered

Image copyright Getty Images Image caption The Clintons, Bushes, Reagans, Carters and Fords at the Nixon funeral in 1994.

The New York Times has looked at other moments in recent times when leaders of the US were together:

Dedication of the Ronald Reagan Presidential Library in California in 1991 - President Bush plus Nixon, Ford, Carter and Reagan

Funeral of Richard Nixon, also in California, in 1994 - President Clinton plus Ford, Carter, Reagan and Bush

Ronald Reagan memorial in Washington in 2004 - President W Bush plus Carter, HW Bush and Clinton

Dedication of George W Bush Library in Texas in 2013 - President Obama plus two Bushes, Carter and Clinton

Hurricane recovery efforts in 2017 in Texas - former presidents Obama, W Bush, Clinton, HW Bush and Carter

And some VP history

Let's not forget the vice-presidents who also made the Bush memorial service on Wednesday an occasion of historical note.

Former White House Press Secretary Ari Fleischer noted that every living VP since 1977 was present.

More on the HW Bush funeral events