From the tag and the name of the quota I infer it is Indian Railways. The short answer is Yes, the fifth passenger is allowed to travel with you. This rule does have some exceptions like for travel in Rajadhani /Shatapdi Express this would not be applicable but for the trains you indicated it is allowed.
The rules relating to this are shown on the Indian Rails website
Name of the passengers whose names are partly confirmed/partly waitlist or partly RAC/partly waitlist, their names shall appear in charts including the waitlist passengers.
So once name is in chart they can board the train and travel with their party, however the TTE is bound to allot them a berth after allotting berths to all other confirmed passengers and RAC passengers.