The thought is that forceful coughing puts pressure on the heart, forcing it to pump blood. This may work for a few seconds while an abnormal heart rhythm passes, but only on a conscious, responsive person in specific situations. This topic is not taught in CPR classes for the simple reason that CPR intervention is based on a victim's unresponsiveness and coughing CPR would just be additional data to remember with virtually no application in the field.
This may change as more is learned over the years, but for now the best thing a person can do when he begins to experience cardiac arrest or heart attack is to call 9-1-1. If there are any people around, get their attention so they know you need help too.