RefCountedPtr fixes

This PR fixes a few shortcomings of our ```RefCountedPtr``` implementation:

1. ```RefCountedPtr``` could only be assigned if exactly the same. This made it impossible to write const-safe code. For example you could not assign a ```RefCountedPtr<Something>``` to a ```RefCountedPtr<const Something>``` while the same with normal pointers would work (```const Something* = Something*```). I added template variants of the copy constructor and the assignment operator to allow copy and assignment, as long as it would be legal for the underlying bare pointers.
Moreover, the reference counter should be ```mutable``` to also work for constants (logical constness).

2. Our ```RefCounted``` base class did not define copy constructor and assignment, which means, the compiler would generate default ones copying by attribute. However, this is wrong, as the reference count should not be copied. It should be set to 0 on construction, or kept the same on assignment (it should only changed if ```RefCountedPtrs``` to them are copied, not the ```RefCounted``` itself).
I'm not sure, if (and how) we should handle move constructor and move assignment.

3. The reference counter should be atomic to avoid races from different threads (e.g. I had double deletes when passing ```RefCountedPtrs``` to the same object to a function from different threads). As atomics are not copyable this revealed also point 2.

I would be grateful for some extra heads thinking it over, before merging, as that is in a quite central place of our code base and I'm not that experienced in this part of C++.