In an episode of TNG, Commander Riker temporarily served as the second officer on a Klingon warship. It was apparently a reciprocal arrangement between Starfleet and the Klingon empire. In the episode Riker, if I remember correctly proved his worth to the Klingons by taking command of the Klingon vessal and convincing the Klingons that he was prepared to lead them in battle against the Enterprise after some sort of misunderstanding. Picard promptly surrendered the Enterprise and the matter was cleared up somehow. The Klingon captain was then allowed by Riker to win a fight and regain command of his ship. Riker then returned to the Enterprise.<br/><br/>Someone more versed in canon might have more information on the treaty or episode that established that this officer secondment was taking place.<br/><br/>edit. Managed to find the relevent episode.<br/><br/>Riker was an early participant in the Officer Exchange Program, temporarily transferring to a Klingon Bird-of-Prey, the IKS Pagh, in 2365. To prepare for the assignment, he indulged in many different Klingon foods. Worf also gave him an emergency transponder shortly before his departure, just in case of an emergency situation. On board the Pagh, Riker had to quickly learn the Klingon way of doing things, physically fighting the second officer to prove his loyalty to Captain Kargan and enduring the abusive comments of the Klingon crew. At the same time, the Enterprise became infected with a hull-degrading bacteria, which it inadvertently transmitted from the Pagh. The Klingons believed that it was a new Federation weapon, and returned to attack the Enterprise. Riker was able to relieve Kargan by giving him the transponder and sending him to the Enterprise, then staging a mock battle with the Starfleet vessel to maintain the honor of the Klingon crew. Riker returned to his post aboard the Enterprise following the incident. (TNG: "A Matter Of Honor")<br/><br/>Additional information on the officer exchange program.<br/><br/>The Officer Exchange Program was established in the 2360s as a way of improving relations between the United Federation of Planets and the Klingon Empire. Commander William T. Riker of the USS Enterprise-D volunteered for the program and was posted aboard the IKS Pagh, a Klingon Bird-of-Prey. The Benzite, Mendon, was posted aboard the Enterprise-D as part of the same program. (TNG: "A Matter Of Honor")<br/><br/>Kurn, the second son of Mogh, later joined the program as a way of meeting his brother Worf. (TNG: "Sins of the Father")<br/><br/>The Klingon spy, J'Dan later used the program to give information on the ship to the Romulans. (TNG: "The Drumhead")<br/>