There is not going to be a single solution here that will be applicable to all airlines everywhere in the world.
Generally, the thing to do is to contact the airline, explain the situation, and ask them what to do. I reccomendrecommend that your friend gets the airline's response in writing. Then, after following their instructions, your friend can then bring that written response with them while traveling. That way, your friend will have something solid to refer to should anyone question them.
An extra tip for contacting airlines: In those cases when the airline is based in a conservative or politically religious country and might not be familiar with such topics, there is no need for your friend to mention that they are gender-neutral. Your friend may simply say (factually) that in their passport, their gender is represented as X (indeterminate/unspecified). This may maximize the chances of getting a helpful response. If the airline happens to ask why that is the case, your friend can then elaborate.