Most people with heart failure can safely drive a car. However, people who have a history of loss of consciousness or fainting due to an abnormal heart rhythm (arrhythmia) in general should talk to their doctor about their ability to drive safely.
People who drive for a living are likely to require regular review of their condition, and in some countries, may be excluded from driving. If you drive a heavy goods vehicle or public service vehicle, you should ask your doctor to check the latest information from your national Driver and Vehicle Licensing Agency for current guidance on chronic heart failure. Having a pacemaker/defibrillator may not necessarily prevent you from keeping your driver's license.
There are national restrictions for driving after having a pacemaker/defibrillator implanted that you have to consider, so you should discuss this issue with your doctor.