Only the parent that lived with the child more than half the year (custodial parent) can claim the child care credit.
Child care is "work related". It can only be claimed if the care was necessary so that you (and your spouse if married) could work. Only if the child lived with you more than half the year *and* the care was required so that you could work is it allowed. If you did not live with the child or work at the time that the care was provided then it was not necessary so that you could work and therefore is not allowed.
See IRS Pub 503.
https://www.irs.gov/publications/p503#en_US_2018_publink100048433
**Disclaimer: This post is for discussion purposes only and is NOT tax advice. The author takes no responsibility for the accuracy of any information in this post.**