With a date for tea with the Queen in the bag for the Chinese premier, Li Keqiang, this week, Beijing decided to place Britain ever so gently in its place.

Britain now ranks behind Germany and France among the pre-eminent powers in Europe, the Chinese ambassador Liu Xiaoming declared on the eve of the premier's three-day visit to Britain, which starts on Monday.

The remarks by the ambassador, who highlighted a series of missed opportunities by Britain, ranging from the failure to build a third runway at Heathrow to an overly restrictive visa regime, show the delicate challenge in managing diplomatic relations with China.

David Cameron, in common with all his immediate predecessors, believes that Britain must forge a strong political and economic relationship with a country that is on course to move ahead of the US as the world's largest economy.

But the remarks by the ambassador show that China has little time for the usual diplomatic niceties and likes to remind European countries in general – and one with such a sensitive colonial past, in particular – just who is top dog in the 21st century.

The prime minister has faced the same challenge as each of his predecessors since Margaret Thatcher laid the basis for the return of Hong Kong to China in 1997, as a special administrative region, in the 1984 Sino-British joint declaration. Thatcher had initially wanted to hang on to Hong Kong island, which had been ceded to Britain in perpetuity under the 1842 Treaty of Nanjing. But officials advised Thatcher that Britain had no ability to challenge China.

More than a quarter of a century later, Cameron has faced a dilemma of his own, though this has been on a more modest scale. This was discussed over a Soho dinner among some of his closest political allies a year ago as he prepared for his second visit to China which was to be preceded by a visit by George Osborne. The gist of the dinner was to work out how Britain could tap into the vast economic opportunities of China while holding firm to its values on human rights.

An internal Whitehall debate had been under way after China put diplomatic relations with Britain in the fridge, not the freezer, after Cameron and Nick Clegg met the Dalai Lama in 2012. Hugo Swire, the Foreign Office minister, urged caution over the dinner. But Osborne called for a hard-headed approach, saying Britain needed to throw itself into building the strongest possible relationship with China.

Needless to say, the chancellor prevailed. Within months, the prime minister embarked on his long-delayed visit to China, declaring in the Chinese weekly news magazine Caixin: "There is no country in the western world more open to Chinese investment."

Human rights were on the agenda during Cameron's visit in December as they will be during Li's visit this week. But all EU countries have devised a formula to avoid causing too much offence to the Chinese, known as a "human rights dialogue". Cameron will refer to this dialogue in his meeting with Li, allowing him to say human rights have been raised without necessarily discussing the issue in great detail.

Ann Clwyd, a Labour member of the Commons foreign affairs select committee, says Cameron should not be afraid to challenge the Chinese. Clwyd says: "I suspect we don't get the balance right when trade is an issue. And this government is very hot on trade. But MPs must put pressure on the prime minister to raise the controversial issues with the Chinese."

All sides seem resigned to acknowledging the overwhelming economic might of China. Perhaps change might come from the very top: the Prince of Wales once appeared to boycott a state banquet for the former president Jiang Zemin, allegedly in protest at the treatment of the Dalai Lama.