Generally speaking, if the government's aren't actively hostile, navies welcome each other's ships. Officially, it is about some joint bullshit or laying up supplies like food and fuel. Unofficially, it is for the sailors to go to shore, get drunk, and get laid, thus, boosting morale.