South Africa opt to bat first against Afghanistan