US President Barack Obama has warned British voters that the UK would find itself "at the back of the queue" for a trade deal with the US if they vote against staying in the European Union in the June 23 referendum.

British proponents of a so-called Brexit said they were outraged that an American president appeared to be trying to influence the outcome of such a crucial vote.

Obama said on Friday during his three-day visit to London that the UK's influence on the world stage was "magnified" by its membership of the 28-member bloc.

"I think this makes you guys bigger players," he said at a joint news conference with David Cameron, the British prime minister.

"It's fair to say that maybe some point down the line there might be a UK-US trade agreement but that's not going to happen anytime soon because our focus is negotiating with a big bloc, the European Union, to get a trade agreement done."

In an op-ed published by The Telegraph shortly after his arrival in the British capital on Thursday, Obama said that the UK should be proud that the EU has helped spread British values and practices - democracy, the rule of law, open markets - across the continent and to its periphery.

In his article, Obama argued that the UK had benefited from being inside the EU in terms of jobs, trade, financial growth and security.

"This kind of cooperation - from intelligence-sharing and counterterrorism to forging agreements to create jobs and economic growth - will be far more effective if it extends across Europe. Now is a time for friends and allies to stick together," he wrote.

Obama and his wife Michelle congratulated Queen Elizabeth, who celebrated her 90th birthday on Thursday, before he proceeded to Downing Street for talks with Cameron.

'Double standards' claim

Obama's intervention before the forthcoming EU referendum on June 23 was welcomed by supporters of the "Remain" campaign, but those who want to leave the EU accused him of hypocrisy.

Iain Duncan Smith, a Tory MP who campaigns for the UK to leave the EU, accused Obama of double standards.

"He is asking the British people to accept a situation that he patently would not recommend to the American population," he said.

"I can imagine no circumstances under which he would lobby for the US Supreme Court to be bound by the judgments of a foreign court."

OPINION: Brexit and the failure of the European Union project

Boris Johnson, London mayor and Brexit campaigner, also criticised Obama's involvement in the debate.

Writing in The Sun, he claimed that Obama's view was "a breathtaking example of the principle do-as-I-say-but-not-as-I-do".

However, in his article headlined "As your friend, let me say that the EU makes Britain even greater", Obama acknowledged that "ultimately, the question of whether or not the UK remains a part of the EU is a matter for British voters to decide for yourselves".

But he also said: "... the outcome of your decision is a matter of deep interest to the United States."

Dinners with the royals

German Chancellor Angel Merkel, French President Francois Hollande and several Commonwealth leaders have already spoken out against Brexit.

During his state visit last year, China's President Xi Jinping also said China wanted Britain to remain in the EU.

During his official visit to the UK, Obama had lunch with Queen Elizabeth in Windsor Castle.

He also had dinner with the Duke and Duchess of Cambridge.