Now this was fun to research. Good question!
For all sense and purposes legal battles are trouble, expensive and take time. So avoid them -- in this case a simple contract with details on who owns the copyright would help. Often a contract can be verbal.
Here are my thoughts on what the legal situation could be. I am not that well versed in law nor in copyright law in particular. Also these things are highly depending on the jurisdiction you are in. The following will apply to German law.
Relevant article in German Copyright Law
This site has details in German about copyright law for photographers. The linked to section says:
Können auch mehrere Menschen der Urheber eines Fotos sein?
Ja, dieses ist nach § 8 UrhG möglich. Demnach liegt eine Miturheberschaft vor, wenn mehrere Urheber gemeinsam ein Werk erschaffen.
Can multiple persons be creators of a photo? Yes, this is possible under § 8 UrhG. Accordingly, a co-creation exists if multiple creators created a work.
The article (§8 UrhG) says that proceeds are split in accordance to the contribution of each photographer and that one author can give up the rights to the proceeds (you cannot give up copyright itself but that is a German peculiarity). So, my practical tips would actually work, even after the fact.
In detail look at the creation of the photo
Now, the first source says that mere assistant work does not make one a joint author! The question now is: Are either A or B just assisting? I would argue that B by pressing the shutter is the assistant! (Please put it on autofocus that makes the case more clear cut ;) ).
A is choosing the setup, location, composition and also setting up the lighting. These are all things that lift the photograph from being a "Lichtbild" to being a "Lichtbildwerk" (the former is a photograph, the latter a photograph with artistry). So, all A does is what makes the picture.
B is focusing and pressing the shutter. Focusing is somewhere between a skill and creativity. The situation could be a tilt-shift lens where focus is most definitely creative to automatic focus on pressing the shutter.
Pressing the shutter has the creative element of "choosing the right moment". Although, B could always set it on continuous and A's using the spray-and-pray technique is definitely not creative. In portrait photography, one should also consider the interaction between photographer and subject.
This is not clear cut but I assume that B is classified as the assistant and thus not a copyright holder.
- Just found this source. The author is a lawyer so his advice should be correct (believe that if you will). Here, the photographer is "A" and the assistant is "B". However, the assistant is assumed to be hired for this purpose and as such to be a subordinate of the photographer.
alle wesentlichen Einstellungen von dem Fotografen selbst oder nach seinen genauen Anweisungen von dem Assistenten vorgenommen werden, erwirbt der
Assistent als weisungsabhängiger und damit untergeordneter Mitarbeiter keine
eigenen Urheberrechte an den Bildern, selbst wenn er nach Abschluss der Vorbereitungen den Auslöser betätigt.
If all essential settings were made by the photographer or according to his specific instructions [...] then the assistant as a subordinate does not gain copyright on the pictures, even if he pressed the shutter [...].
The author then goes on that if the assistant did make creative decisions she will become a joint author! So, very similar to my take on things and now we got that problem solved and opened the can of worms of what is a creative decision.