context: When the Seven Years' War between France and Great Britain started in 1756, Spain and Portugal remained neutral. Their differences in South America had been settled by the Treaty of Madrid . King Ferdinand VI of Spain's prime minister Ricardo Wall opposed the French party who wanted to enter the war on the side of France. Everything changed when Ferdinand VI died in 1759 and was succeeded by his younger half-brother Charles III of Spain. Charles was more ambitious than his melancholic brother. One of the main objects of Charles's policy was the survival of Spain as a colonial power and, therefore, as a power to be reckoned with in Europe. By 1761 France looked like losing the war against Great Britain. Furthermore, Spain suffered from attacks by English privateers in Spanish waters, and claimed compensation. Fearing that a British victory over France in the Seven Years' War would upset the balance of colonial power, he signed the Family Compact with France  in August 1761. This brought war with Great Britain in January 1762. After Portugal had been struck by the disastrous 1755 Lisbon earthquake, Prime Minister Sebastião José de Carvalho e Melo, Marquis of Pombal directed all efforts towards the reconstruction of the country, and neglected the armed forces, for which he had little interest anyhow. By the Treaty of El Pardo  between Spain and Portugal, all aspects of the Treaty of Madrid were null and void.
question: Who did Charles III of Spain replace?
answer: Ferdinand VI