In his early childhood, raised in the Swedish court alongside his cousin Queen Christina, he received an excellent civil education. Later Charles X learned the art of war under Lennart Torstenson, being present at the second Battle of Breitenfeld (1642) and at Jankowitz (1645). From 1646 to 1648 he frequented the Swedish court, supposedly as a prospective husband of his cousin the queen regnant, Christina of Sweden (1626–89, reigned 1632–54), but her insurmountable objection to wedlock put an end to these anticipations, and to compensate her cousin for a broken half-promise she declared him her successor in 1649, despite the opposition of the Privy Council headed by Axel Oxenstierna. In 1648 he gained the appointment of commander of the Swedish forces in Germany. The conclusion of the treaties of Westphalia in October 1648 prevented him from winning the military laurels he is said to have desired, but as the Swedish plenipotentiary at the executive congress of Nuremberg, he had an opportunity to learn diplomacy, a science he is described as having quickly mastered. As the recognized heir to the throne, his position on his return to Sweden was dangerous because of the growing discontent with the queen. He therefore withdrew to the isle of Öland until the abdication of Christina on 5 June 1654 called him to the throne.