TL;DR: Having a clear differentiation between first and second author helped us a lot
After authoring a paper with a researcher from a pretty different field I became friends with the first author (I was a co-author). What we actually did was to write two papers: One for the other researcher's field (biology) and one for my field (statistics). Then both got a first-author paper out of it.
In my experience it helped a lot that it was clear who was the one responsible for the respective research paper and who was the sidekick. The first author did most of the writing and setting up the experiment structure and so on - setting the plan if you will and being responsible for the respective paper/project. The sidekick focused on their part. For me it helped to not argue about things and to have clear responsibilities. The last thing I want is to get into a inter-personal conflicts. Research is hard enough.
So, it turned out to be actually good that one of us clearly put in more work and that this was the first author and that this was fixed before starting to work on the project.