Anthony Scaramucci, the new White House communications cirector, was once berated by Barack Obama during a town hall debate in 2010.

In the newly resurfaced CNBC footage, Mr Scaramucci, who was a hedge fund manager at the time, told the former President: “I represent the Wall Street community, we have felt like a pinata, maybe you don't feel like you're whacking us with a stick but we certainly feel like we've been whacked with a stick.

“I certainly think that Main Street and Wall Street are connected, and if we’re going to heal the society and make the economy better, how are we going to work towards that, healing Wall Street and Main Street?”

Mr Obama replied: “I have been amused over the last couple of years, this sense of somehow me beating up on Wall Street. I think most people on Main Street feel they got beat up on.”

The audience cheered at his response, and he continued: "And I'll be honest with you. There’s a big chunk of the country that thinks that I have been too soft on Wall Street. And that's probably the majority, not the minority."

Donald Trump's international Presidential trips Show all 22 1 /22 Donald Trump's international Presidential trips Donald Trump's international Presidential trips French President Emmanuel Macron and US President Donald Trump AFP/Getty Images Donald Trump's international Presidential trips French President Emmanuel Macron and US President Donald Trump talk as they leave the Army Museum at Les Invalides in Paris AFP/Getty Images Donald Trump's international Presidential trips German Chancellor Angela Merkel and US President Donald Trump arrive for the group photo at the G7 Taormina summit on the island of Sicily in May 2017 Getty Images Donald Trump's international Presidential trips Mr Trump was pressed on the subject at the G7 summit in Italy Getty Donald Trump's international Presidential trips US President Donald Trump gives a speeech at the Warsaw Uprising Monument on Krasinski Square Getty Donald Trump's international Presidential trips US President Donald Trump and Britain's Prime Minister Theresa May during a ceremony at the NATO headquarters before the start of a summit in Brussels, Belgium Reuters Donald Trump's international Presidential trips Montenegro's Prime Minister Dusko Markovic is seen to the right of Donald Trump at a Nato summit in Brussels REUTERS Donald Trump's international Presidential trips Pope Francis meeting with US President Donald J. Trump EPA Donald Trump's international Presidential trips Pope Francis poses with US President Donald Trump and First Lady Melania Trump AFP/Getty Images Donald Trump's international Presidential trips US President Donald Trump arrives at Palazzo del Quirinale ahead of the meeting with Italian President Sergio Mattarella Ufficio Stampa Presidenza della via Getty Donald Trump's international Presidential trips US President Donald Trump is seen during a joint press conference with the Palestinian leader at the presidential palace in the West Bank city of Bethlehem AFP/Getty Images Donald Trump's international Presidential trips Palestinian president Mahmoud Abbas meets US President Donald Trump PPO via Getty Donald Trump's international Presidential trips Israeli Prime Minister Benjamin Netanyahu speaks with US President Donald Trump prior to the President's departure GPO via Getty Images Donald Trump's international Presidential trips US President Donald Trump and Israel's Prime Minister Benjamin Netanyahu shake hands after delivering a speech at the Israel Museum AFP/Getty Images Donald Trump's international Presidential trips US President Donald Trump and First Lady Melania Trump lay a wreath in the Hall of Remembrance as White House senior advisor Jared Kushner and Ivanka Trump watch on during a visit to the Yad Vashem Holocaust Memorial museum AFP/Getty Images Donald Trump's international Presidential trips US President Donald Trump visit to Yad Vashem Holocaust museum in Jerusalem accompanied by Prime Minister Benjamin Netanyahu GPO via Getty Images Donald Trump's international Presidential trips US President Donald Trump takes his seat before his speech to the Arab Islamic American Summit in Riyadh in Saudi Arabia Reuters Donald Trump's international Presidential trips Saudi Arabia's King Salman bin Abdulaziz al-Saud, US President Donald Trump and US First Lady Melania Trump look at a display of Saudi modern art at the Saudi Royal Court in Riyadh AFP/Getty Images Donald Trump's international Presidential trips US President Donald Trump and Saudi Arabia's King Salman bin Abdulaziz al-Saud take part in a signing ceremony at the Saudi Royal Court in Riyadh AFP/Getty Images Donald Trump's international Presidential trips King Salman presents Donald Trump with The Collar of Abdulaziz al-Saud Medal at the Royal Court Palace on 20 May AP Donald Trump's international Presidential trips US President Donald Trump is welcomed by Saudi King Salman bin Abdulaziz al-Saud upon arrival at King Khalid International Airport in Riyadh AFP/Getty Images Donald Trump's international Presidential trips U.S. President Donald Trump and first lady Melania Trump walk on the South Lawn prior to their first foreign trip Getty Images

Donald Trump's new communications director and Mr Obama were Harvard Law School classmates and played basketball together.

Mr Scaramucci once said that Mr Obama has "the best smile in American politics since Jack Kennedy" and even donated to his 2008 presidential campaign.

However, his opinion appears to have changed at some point during Mr Obama's first term in office, just after the economic crisis.

Since taking on his new role, the combative Wall Street financier deleted several of his previous Twitter posts questioning Mr Trump's decisions.

He said his own views had evolved and what he said in the past shouldn't be a distraction.

Social media users quickly recirculated past tweets by Mr Scaramucci that were at odds with Mr Trump's views, including one that praised Hillary Clinton's competence.

Other repurposed tweets expressed support for stronger gun laws, which he tweeted about in August 2012. In May 2016, he expressed displeasure with individuals who believe climate change is a hoax. Mr Trump has at times referred to global warming as a hoax.

"Full transparency: I'm deleting old tweets. Past views evolved & shouldn't be a distraction. I serve [Mr Trump's] agenda and that's all that matters," Mr Scaramucci said Saturday in the first of a pair of messages on the subject.