One of the interesting aspects of David Jenkins and Taika Waititi's wacky pirate comedy, Our Flag Means Death, is its exploration of same-sex pirate relationships, both platonic and otherwise. Taika touched on this in an interview and even offered up the pirate word for it, metalotage.
I was certainly aware that there was a lot of "friggin' in the riggin'" during "the golden age of piracy" (it gets lonely at sea, as the saying goes), but I wasn't aware of the concept of matelotage or what it meant. This piece on All Things Interesting offers some background.
In pirate communities of the 17th and 18th centuries, ships were male-dominated, tightly packed, and the ship's crew largely formed their own mores and rules. Matelotage developed in that environment where crew mates often knew one another more intimately than the wives and children they'd left behind on land.
In some cases, matelotage was affectionate, even fraternal; in others, it was romantic and sexual. But regardless of the nature of each relationship, pirates took the bonds of matelotage very seriously.
As far as historians can tell, matelotage began during the 1600s. The word derives from the French matelot, which means sailor or seaman. "Matey" likely also derives from matelot, making it a sort of cousin-word to matelotage.
It's believed that matelotage began as a strictly economic partnership. One pirate would agree with another that they could inherit the lion's share of their fortune after leaving "part to the dead man's friends or to his wife," according to The Invisible Hook by Peter T. Leeson. Some historians describe it as something like an informal will.