Spanish companies will commit millions of pounds of investment to Britain on Thursday, the British government said, as it seeks to limit the economic impact of leaving the European Union.

The investment plans, which include building trains and trams in Britain, coincide with a three-day state visit to Britain by Spain’s King Felipe and Queen Letizia.

King Felipe and British trade minister Liam Fox are due to address a U.K.-Spain business forum in London on Thursday, before the Spanish monarch holds bilateral talks with Prime Minister Theresa May at her Downing Street residence.

Britain said the investments would include Spanish manufacturer CAF committing 30 million pounds ($39 million) to build trains and trams at a new factory in Wales, creating 300 jobs, and Spanish infrastructure company Sacyr unveiling plans for a new office in London.

Bilateral trade strong

Bilateral trade between the two countries was worth 40 billion pounds in 2015, and more than 400 Spanish companies are registered in Britain, the government said.

“The sheer scale of Spanish investment in Britain demonstrates Spain’s continued confidence in the strength of the UK economy, and shows that we can and will maintain the closest possible relationship,” May said in a statement.

The government also highlighted more than 100 million pounds which is being invested in the expansion of Luton Airport, majority owned Spanish airport operator AENA, and the construction of a 26 million pound factory in the West Midlands by Spanish steel producer Gonvarri Steel Services.

Gibraltar remains issue

Away from the financial deals, the Spanish royal visit comes amid tensions over the post-Brexit future of the British territory of Gibraltar, which Spain wants back.

The future of Gibraltar, a rock on the southern tip of Spain captured by Britain in 1704, and its 30,000 inhabitants, is set to be a major point of contention in the Brexit talks.

During an address to members of both houses of parliament in London on Wednesday, Felipe said he was confident that Spain and Britain could work towards an acceptable arrangement over Gibraltar.

May to meet with King Felipe

The EU and Britain have also yet to agree on guarantees for EU citizens living in the UK and British expats living in other EU countries. More than 300,000 Britons live in Spain, while more than 130,000 Spaniards live in Britain.

On Wednesday, Felipe said these citizens had “a legitimate expectation of decent and stable living conditions” and urged the British and Spanish governments to work to ensure the Brexit agreement provided sufficient assurance and certainty.

May’s office said that during her talks with Felipe she would welcome the contribution that Spanish citizens make to Britain’s economy and society.