Under capitalism, a child’s education is paid for by their guardians (parents), or by voluntary donations by private individuals or groups of private individuals, e.g., family members, church groups and non-religious groups, private scholarships (either merit or need-based), or by individuals donating their time to teach others, etc.

As for those who cannot afford to pay for their education they can resort to private loans, private charity (which can be promoted by the use of tax credits for education.), etc. Under capitalism, since there would be no public schools, more private schools would appear, which would lead to more competition and innovation to decrease in the cost of education. Observe that as the government has increased its stranglehold on college education, the price has increased as the quality has plummeted.