After graduating with high honors in 1871, Yan Fu went on to spend the next five years at sea. He first served aboard the training ship "Jianwei" () and later on the battle cruiser "Yangwu" (). In 1877–79 he studied at the Royal Naval College, Greenwich, England. During his years there, he became acquainted with China’s first ambassador Guo Songtao, and despite their age difference and status gap developed a strong friendship. Benjamin Schwartz mentions in his biography that "they often spent whole days and nights discussing differences and similarities in Chinese and Western thought and political institutions".