Image caption The UK joined the then European Economic Community in 1973, before voters agreed in a 1975 referendum that it should remain

It was a story of break-up and betrayal, and of a long-distance relationship that went sour.

It's not a cliffhanger from Shortland Street, New Zealand's longest-running TV soap opera, but a real-life tale of abandonment.

It happened back in January 1973 to the South Pacific nation when the UK joined the then European Economic Community (EEC), the precursor to today's European Union.

At the time, about half of Kiwi exports were shipped 18,500 km (11,500 miles) to the UK, but access to those prized markets would effectively end as a result of the UK joining the EEC.

"It was a massive shock. It was an emotional shock for New Zealand," says Asha Sundaram from the University of Auckland.

"Almost 50% of New Zealand exports went to the UK at the time, and so there was huge anxiety about what would happen.

"Essentially New Zealand was like an outpost of Britain [back then]. It was this parent-child relationship, and I think people were just terrified of the apron strings being cut off.

"I think it was probably panic."

Image copyright Getty Images Image caption New Zealand is today a major exporter of wine to the UK

In 1973, colour TV was being beamed into Kiwi living rooms for the first time (in time for another royal wedding, that of Princess Anne and Mark Phillips) while Wellington's opposition to French nuclear testing in the region was intensifying.

The UK's attempts to be a part of the EEC had been a long-time coming, but when it finally happened there was a sense in New Zealand of being sold-out by an old friend.

"I do think there was a sense of betrayal, particularly among older New Zealanders," says Stephen Jacobi, executive director of the New Zealand International Business Forum.

"I myself was born in Britain, so my family emigrated from Britain to New Zealand. It is hard to think of Britain as a foreign country.

"We were conceived as a farm for Britain. That was our rationale for existence in the world order as it was."

Fast-forward 45 years and the Kiwi economy has been transformed.

Image copyright Getty Images Image caption Lamb exports are still big business for New Zealand

Free trade agreements with Australia, China (in 2008) and others have been critical. So were the bold reforms beginning in the 1980s that opened up an ailing "fortress economy" that had been highly protected.

"New Zealand was the first country to do a high quality free trade deal with China," says Catherine Beard, head of Export NZ, a lobby and advocacy group.

"We've taken a really principled approach to trade, so we reduced all the tariffs in New Zealand many years ago, we don't have subsidies.

"And we don't have any kind of smoke and mirror support for companies domestically, and the ones that survived have thrived.

"Our industry is actually remarkably robust, and so are our farmers because they have always had to be globally competitive without support."

Farming is important to New Zealand, as are forestry and fishing, along with the services sector, tourism and education.

As Brexit draws closer, are there important lessons for the UK in its former colony's economic revival? New Zealand's journey since the early 1970s has been turbulent at times, and tough decisions have been made along the way.

A nimble, creative and diversified economy is key, as is the endeavour to find new markets.

Image copyright Getty Images Image caption New Zealand now has a modern economy

In an ultra-competitive world, Kiwi exporters must always be on top of their game, according to Peter Busfield, who represents the marine industry.

"We are a long, long way from any markets, we're really at the end of a no-exit street as far as the world is concerned," he says.

"We've got to go out and introduce ourselves to the various markets, and have a value proposition that satisfies those customers more so than them buying from their next-door neighbouring country.

"So New Zealand always has to perform outstandingly well to break into any market."

Global Trade

More from the BBC's series taking an international perspective on trade:

Today Australia buys more Kiwi exports than anyone else, while China makes up about 20% of New Zealand's overseas trade. The UK now accounts for just 3%, which is worth 1.6bn New Zealand dollars ($1.1bn; £830m).

New Zealand's exports to the UK largely comprise meat, beverages and fruit, and there is appetite for a New Zealand-UK free trade agreement.

Image copyright AFP Image caption There are about 30 million sheep in New Zealand

"While Britain is…not a major trade partner for New Zealand, it still is a very important investment partner," says Mr Jacobi.

"Britain is the third largest investor in New Zealand after the United States and Australia, so the relationship is still very significant. What we have now, maybe, is an opportunity to bring it up to date and place it more in the 21st Century."

Four-and-a-half decades after a nasty divorce the UK is reaching out to New Zealand again. The irony of this volte-face isn't lost on many Kiwis, but you'll find few here who still bear a grudge.

A NZ-UK trade deal will be a priority for post-Brexit UK, according to Theresa May's government. As it looks for new partners, a faraway friend it spurned in the past could perhaps help it embrace the challenges ahead.