If the USS Voyager had met the USS Equinox earlier in the series & for whatever reason the Equinox's crew joined Voyager's crew (like Chakotay & his crew did), who would be in charge between the two Starfleet captains, Janeway or Ransom?
Janeway is in charge of Voyager. If the crew of the Equinox would join with Voyager's crew as the crew of the Val Jean did, Janeway would still be in charge of Voyager - that is her command granted by Starfleet. Ransom was not given command of Voyager. He may have the same rank as Janeway but his ship is the Equinox. If he decides to abandon it (for whatever reason) he is no longer captaining any ship - and surely not Voyager.
If the Equinox wouldn't be abandoned, Janeway would still be in charge as stated in that very episode:
JANEWAY: Normally I'd agree, but right now one of our ships in vulnerable. Chakotay's right, we should make our stand on Voyager.
RANSOM: I don't want to force the issue, but I am prepared to return to the Equinox with my crew. What is the protocol in this situation? We have two Captains and two ships. Who gets the last word?
JANEWAY: Starfleet Regulation one hundred ninety one, Article fourteen. In a combat situation involving more than one ship, command falls to the vessel with tactical superiority. I looked it up this morning.
My understanding of Real Life military is thus: whoever has held the rank longer is considered to be senior. Memory Alpha states that seniority is one of several factors in determining who is the ranking officer.
There is the aforementioned Regulation 191 which states: In a combat situation involving more than one ship, command falls to the vessel with tactical superiority, should there not be a higher ranking officer present. (VOY: "Equinox")
Memory Alpha states regarding that regulation: In the novelization, Janeway admits to herself she made the regulation up.
To add to all the other correct answers that state that Janeway would retain command, the term "Captain" in naval military terms can be both a rank, and a title independant of one's rank. It is not uncommon for someone to hold the title of Captain, but not the rank. In this situation the person who holds command authority over the vessel in question (Voyager) would be whomever was assigned as the commanding officer in the first place. There's very few situations where a commanding officer would lose and or give up that position, the most obvious one is the completion of their orders. Military orders have a finite timeframe (for CO's it's usually between 3-5 years) during that timeframe all power and authority of command of the vessel resides with that one person regardless of the rank of all other individuals onboard. Those orders would come from Starfleet Command and therefore supercede all other orders given by a lower ranking office.
To add a bit of personal touch, I myself am currently serving as an enlisted member of the US Coast Guard, and it's not uncommon to have a vessel commanded by an enlisted member, which may have a commisioned officer onboard from time to time (for training of said officer in ship handling, area familiarization etc.) Regardless of the division between officer and enlisted members whomever holds the title of Officer in Charge/Commanding Officer is the one in charge. I've heard several stories of junior enlisted members having to give senior officers orders to maintane ship stability in emergency situations.
TL;DR: Rank =/= Command, assignment orders do!
Had this happened earlier in the series (let's not forget it is there to entertain us) then no doubt we would see some power struggles between Janeway and Ransom. And perhaps with the "criminal" Chakotay caught in the middle - now that I would have liked to see - throw in a baddie like Seska into the equation and we could have seen a lot of interesting dynamics.
Janeway would obviously still command her own vessel, but Ransom would have had more than one occasion to question her actions. For example:
In the end though, Ransom would submit to Janeway's authority. The dictates of poetics state that a character's actions must flow inexorably from his or her established traits. In Equinox pt 2, Ransom in the end became the good guy again, no doubt he would behave the same in this alternate voyager series.
I would relate this to a similar situation in a different universe.
When Galactica met Pegasus in the new series, Admiral Cain get command on the fleet at large, but Adama kept command on his spaceship. All orders from Cain passed through him, and were given to his crew by him, even if he were not in position to do any otehr thing than to obey the orders.
Cain being Admiral was still unable to remove Adama from the command of Galactica, this is why she tried to assasinate him, using the people loyal to her that was transferred to Galactica as a result of her orders.
Later on, when the Pegasus was destroyed and all its crew moved to the Galactica, there were no grounds for conflict, since Adama/Apollo (Leland Adama) was of a lower rank than Adama/Husker (William Adama), but if the situation would have been reversed, with Galactica destroyed and Pegasus surviving, Leland Adama would have still being Commanding Officer on the Pegasus, and William Adama would have been Admiral without ship. It is probable that in that case Apollo would have resigned, but that's apart.
So, Janeway would retain command of the Voyager, in any case and situation, but she may have to obey orders from her superiors.
Monty129 has the best answer. In the Royal Canadian Navy, the position of captain of a vessel is conferred for a contractual term, typically to officers with the rank of commander for our destroyers and frigates (commander in french is capitaine de frigate).
The captain of the ship has ultimate say in all matters of the vessel during normal peacetime situations, with very few exceptions, and visiting fleet commanders are just that - visitors.
The Admiral Cain comparison noted by Evite applies to BSG because they are at war. However, even in war time, the regular chain of command is still there. For example, we wouldn't expect Admiral Nimitz in Pacific Theatre to give a command to General Patton in the Western European Theatre.
In this case, Starfleet is not at war, so regulations will be similar to the USN or RCN in the future, then Janeway cannot be relieved, irregardless of the rank or seniority of another Starfleet officer.