Some time before Act I begins, Ralph Rackstraw, an able seaman, has fallen in love with Josephine, the daughter of his commanding officer, Captain Corcoran. Likewise, Little Buttercup, a buxom peddler from Portsmouth, has fallen in love with the Captain himself. Class distinction stands in the way of both the Captain and Ralph reciprocating the affection of the ladies. The Captain has, in fact, been arranging a marriage between Josephine and Sir Joseph Porter, the First Lord of the Admiralty, who is a class distinction above the Captain's family. Act I The sailors of Her Majesty's Ship Pinafore are merrily preparing for Sir Joseph's inspection. Little Buttercup hints of a dark secret she is hiding, Dick Deadeye, a member of the crew is grumbling as usual, and Ralph is pining over Josephine. Sir Joseph appears, attended by an entourage of ladies, who are his relatives and who follow him everywhere, for no particular reason other than it allows for young women to join the story. Sir Joseph explains how he became Lord of the Admiralty. He examines the crew and encourages them to feel that they are everyone's equal, except, of course, his. The men of the HMS Pinafore sing a rousing number that Sir Joseph himself has written for them to raise their spirits. Josephine finds Sir Joseph insufferable. Ralph pleads his love to her and finally threatens to kill himself - at which she agrees to elope. The Act I curtain falls with the sailors of the HMS Pinafore rejoicing at Ralph's success - and Dick Deadeye croaking a warning that their hopes will be frustrated. Act II The scene opens with the Captain lamenting his daughter's coldness toward Sir Joseph. Little Buttercup tries to console him, and says that all will turn out well. Sir Joseph enters and tells the Captain that Josephine has thoroughly discouraged him from pursuing her, and that he wants to call the match off. The Captain suggest that his daughter's hesitation is due to her being of a lower class than Sir Joseph, and urges him to assure Josephine that social rank will not be considered a barrier to their marriage. Sir Joseph follows this advice, but Josephine applies his words to the class difference between her and Ralph. Sir Joseph believes she has accepted him, she is reaffirmed in her vow to Ralph, and everyone sings a happy song. Meanwhile, Dick Deadeye has told the Captain of Josephine's and Ralph's upcoming elopement. The Captain intercepts the lovers with the exclamation "Damne!" Unfortunately, Sir Joseph and his relatives hear him and are horrified at his swearing - Sir Joseph sends the Captain to his cabin in disgrace. And when Sir Joseph learns Ralph and Josephine are eloping, he orders Ralph put in irons. Little Buttercup now reveals her secret. Many years ago, she had charge of nursing and bringing up both Ralph and the Captain when they were babies - and, completely innocently, she got them mixed up - so the one they all know as Ralph should really be the Captain and the Captain should be an able seaman. This error is immediately rectified. The sudden reversal of class status of Ralph and the Captain removes Sir Joseph as a suitor for Josephine's hand, and permits her to marry Ralph, and her father to marry Little Buttercup. Sir Joseph resigns himself to marrying his cousin Hebe - as all's well that ends well.